import React from 'react';
import './login.css'
import 'antd/dist/antd.css'
import {useHistory} from 'react-router-dom'
import { Input, Form, Button } from 'antd'
import { UserOutlined, LockOutlined } from "@ant-design/icons";



const FormItem = Form.Item
export default function Login (props) {
   
  
  const loginbtn = () => {
    localStorage.setItem('token',123)
    props.history.push('/home')
  }
  return (
    <div className='entrance'>
      <div className='loginIpt'>
        <div className='ipttitle'>ops后台管理</div>
        <Form>
          <FormItem name="userAccount"
            rules={[{ required: true, message: "请输入账号" }]}>
            <Input
              prefix={<UserOutlined className="site-form-item-icon" />}
              placeholder='请输入用户名/账号' 
            />
          </FormItem>
          <FormItem name="userPwd"
            rules={[{ required: true, message: "请输入登录密码!" }]} >
            <Input
              prefix={<LockOutlined className="site-form-item-icon" />}
              placeholder='请输入密码' type="password"
            />
          </FormItem>
          <FormItem>
            <Button
              type="primary"
              htmlType="submit"
              className="login-form-button"
              size="large"
              block
              onClick={loginbtn}
            >登录</Button>
          </FormItem>
        </Form>
      </div>
    </div>
  )
}
// 
// function login() {
//   return axios.get('/login.json')
// }